#!/usr/bin/env python

"""Batch process images.

Example: hsPictorial.py --log hsPictorial.log infile.txt outfile.txt
"""

import sys
import pprint
from mod.cli import get_cli_args
from mod.log import log, log_messages
from mod.htools import build_filelist, create_thumbnail

# Some development information - gets used with help.
# Status should typically be one of "Prototype", "Development", or "Production".
#
__author__ = 'Holger'
__copyright__ = 'Copyright 2011'
__version__ = '0.0.1'
__version_info__ = tuple([ int(num) for num in __version__.split('.')])
__maintainer__ = 'Holger'
__email__ = 'holger@me.com'
__status__ = 'Prototype'


# MAIN routine
#
def main(cmd_args=None):
    """The main entry point for running the script."""

    # get command line arguments
    args = get_cli_args(cmd_args)

    log.info("=== Logger configured for %s." % __file__)

    # Do some actual work.
    #
    # print 'Infile is %s, outfile is %s' % (args.infile.name, args.outfile.name)
    # log_messages()

    print args.inlist
    exit(0)

    org_jpgs = build_filelist(args.dir)
    for img in org_jpgs:
        create_thumbnail(img)


# Script entry point with exception wrapping
#
try:
    if __name__ == '__main__':
        # Self-testing code goes here.
        # main(['--log-level', 'DEBUG'])
        main()
    else:
        # This will be executed in case the source has been imported as a module.
        pass
except SystemExit:
    # Do not throw error on system exit.
    pass
except:
    print "Something went wrong:", sys.exc_info()[1]
    # Uncomment raise to get more verbose output.
    raise
